/*
 * Alert.fx
 *
 * Created on Oct 10, 2009, 1:22:30 AM
 */
package AlertSystem;
import javafx.scene.text.Text;
import javafx.scene.Node;
import java.lang.Exception;
import java.sql.ResultSet;
import javafx.scene.paint.Color;


/**
 * @author quang
 */

// place your code here
public class AlertWindow extends Window {
    public var patientId: String;
    
    var content: String;    
    function getDataFromDB(patientId: String) {
        var rs: ResultSet; //ResultSet

        try {
            rs = DBConnection.query(connection, "SELECT alert FROM {inDBName}.alert WHERE patientId = '{patientId}'");
            while (rs.next()) {
                content = rs.getString('alert');
            }            
        } catch(ex : Exception) {
            ex.printStackTrace();
        }
    }

    protected override function create():Node {
        getDataFromDB(patientId);
        return Text {
            content: content
            translateY: windowContentYOffset + font3.size * 2
            font: font3
            fill: Color.RED
        }
    }
}
